#include "stdafx.h"
#include "Person.h"
#include <iostream>

using namespace std;

// we dont need this initialization of pResource cus we used shared_ptr
Person::Person(string fname,string lname,int anumber):firstName(fname),lastName(lname),arbitraryNumber(anumber)
{
}

// we dont need this implementation cus we used shared_ptr
//Person::Person(const Person& p):firstName(p.firstName),lastName(p.lastName),arbitraryNumber(p.arbitraryNumber),pResource(new Resource(p.pResource->GetName()))
//{
//}

Person::~Person(void)
{
	//delete pResource;
}

string Person::GetName() const
{
	return firstName +" "+lastName;
}

bool Person::operator<(Person& p)
{
	return arbitraryNumber<p.arbitraryNumber;
}

bool Person::operator<(int i)
{
	return arbitraryNumber<i;
}

bool operator<(int i,Person& p)
{
	return i<p.arbitraryNumber;
}

void Person::AddResource()
{
	//delete pResource;
	pResource.reset();
	pResource=make_shared<Resource>("Resource for "+GetName());
	//pResource=new Resource("Resource for "+GetName());
}

// we dont need this implementation cus we used shared_ptr
//Person& Person::operator=(const Person& p)
//{
//	firstName=p.firstName;
//	lastName=p.lastName;
//	arbitraryNumber=p.arbitraryNumber;
//	delete pResource;
//	pResource=new Resource(p.pResource->GetName());
//	return *this;
//}

